Skip to content

feat(plotnine): implement indicator-sma#3687

Merged
github-actions[bot] merged 3 commits intomainfrom
implementation/indicator-sma/plotnine
Jan 11, 2026
Merged

feat(plotnine): implement indicator-sma#3687
github-actions[bot] merged 3 commits intomainfrom
implementation/indicator-sma/plotnine

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: indicator-sma - plotnine

Implements the plotnine version of indicator-sma.

File: plots/indicator-sma/implementations/plotnine.py

Parent Issue: #3651


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jan 11, 2026

AI Review - Attempt 1/3

Image Description

The plot displays a Simple Moving Average (SMA) indicator chart with a dark blue price line showing daily stock prices over approximately one year (Jan 2024 - Feb 2025). Three SMA overlay lines are visible: a yellow SMA 20 (short-term), a red SMA 50 (medium-term), and a green SMA 200 (long-term). The price fluctuates between roughly $130-$170, showing a downward trend from Jan-Aug 2024 followed by an upward trend from Oct 2024 onwards. The legend is positioned in the upper left corner. The title follows the correct format "indicator-sma · plotnine · pyplots.ai" in bold at the top. X-axis shows dates with rotated labels, Y-axis shows "Price ($)". Grid lines are subtle on the y-axis only.

Quality Score: 91/100

Criteria Checklist

Visual Quality (36/40 pts)

  • VQ-01: Text Legibility (10/10) - Title is bold and large, axis labels are clearly readable, tick labels appropriately sized
  • VQ-02: No Overlap (8/8) - No overlapping text elements, date labels are rotated to avoid overlap
  • VQ-03: Element Visibility (7/8) - Line widths are good (1.5), all four series are clearly distinguishable, alpha of 0.9 works well
  • VQ-04: Color Accessibility (5/5) - Colors are distinct: blue, yellow, red, green - colorblind-friendly choices
  • VQ-05: Layout Balance (4/5) - Good use of canvas space, legend well positioned in upper-left, minimal wasted space
  • VQ-06: Axis Labels (2/2) - Y-axis has units "Price ($)", X-axis labeled "Date"
  • VQ-07: Grid & Legend (0/2) - Grid is very subtle (good), but legend lacks a background/frame making it slightly hard to read against data

Spec Compliance (25/25 pts)

  • SC-01: Plot Type (8/8) - Correct line chart with price and three SMA overlays
  • SC-02: Data Mapping (5/5) - Date on X-axis, price values on Y-axis, correctly mapped
  • SC-03: Required Features (5/5) - All required features present: price line, 20/50/200-day SMAs, legend with periods
  • SC-04: Data Range (3/3) - All data visible, axes accommodate full range
  • SC-05: Legend Accuracy (2/2) - Legend correctly shows "Price", "SMA 20", "SMA 50", "SMA 200"
  • SC-06: Title Format (2/2) - Correct format "indicator-sma · plotnine · pyplots.ai"

Data Quality (18/20 pts)

  • DQ-01: Feature Coverage (7/8) - Shows uptrend and downtrend, SMAs crossing, different lag behavior of each SMA period. Could show a clearer golden/death cross signal
  • DQ-02: Realistic Context (7/7) - Realistic stock price scenario with plausible volatility and price range (~$130-$170)
  • DQ-03: Appropriate Scale (4/5) - 300 business days is appropriate; price range is realistic but somewhat narrow

Code Quality (9/10 pts)

  • CQ-01: KISS Structure (3/3) - Clean linear structure: imports → data → plot → save
  • CQ-02: Reproducibility (3/3) - np.random.seed(42) is set
  • CQ-03: Clean Imports (2/2) - All imports are used
  • CQ-04: No Deprecated API (1/1) - Current API usage
  • CQ-05: Output Correct (0/1) - Saves as plot.png correctly

Library Features (3/5 pts)

  • LF-01: Uses distinctive library features (3/5) - Uses plotnine's ggplot grammar, theme_minimal, scale_color_manual, and proper long-format data transformation with pd.melt which is idiomatic for plotnine

Strengths

  • Excellent use of plotnine's grammar of graphics with proper long-format data transformation
  • Clean color scheme that distinguishes all four series effectively
  • Proper title format following the spec-id · library · pyplots.ai convention
  • Good handling of date axis with appropriate rotation to prevent overlap
  • Realistic synthetic stock price data with visible trend behavior
  • All three SMA periods (20, 50, 200) are correctly calculated and displayed

Weaknesses

  • Legend could benefit from a background/box for better readability against data
  • The SMA 200 line only appears in the final third of the chart due to the 200-day window requirement - this is technically correct but reduces visual impact

Verdict: APPROVED

@github-actions github-actions Bot added quality:91 Quality score 91/100 ai-approved Quality OK, ready for merge labels Jan 11, 2026
@github-actions github-actions Bot merged commit 8cccb9e into main Jan 11, 2026
3 checks passed
@github-actions github-actions Bot deleted the implementation/indicator-sma/plotnine branch January 11, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge quality:91 Quality score 91/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants